/*素材管理*/
import request from '@/utils/request';
import { object2Url } from '@/utils/trans';

/**
 * 获取文件上传签名数据阿里云
 */
export async function userOssSignature() {
  const ts = new Date().getTime();
  const ua = navigator.userAgent;
  const us = {
    ts,
    ua
  };
  let url = `/massage/upload/alyOssSignature${object2Url(us)}`;
  const res = await request.get(url, us);
  console.log(res);
  if (res.data.code === 200) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
/**
 * 获取文件上传签名数据七牛云
 */
export async function qnyOssSignature(data) {
  let url = `/massage/upload/qnyOssSignature`;
  const res = await request.post(url, data);
  console.log(res);
  if (res.data.code === 200) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
